package com.masterclient.app.businessmodule.minemodule.index.imageloader;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.masterclient.app.R;
import com.eoner.baselibrary.utils.ScreenUtils;
import com.youth.banner.loader.ImageLoader;

/**
 * 作者：sean
 * 创建时间：2017/6/14 00:20
 * 功能说明：
 */

public class PersonBannerImageLoader extends ImageLoader {

    private int mWidth,mHeight,radiu;
    public PersonBannerImageLoader(int width,int height) {
        this.mWidth = width;
        this.mHeight = height;
        radiu = ScreenUtils.dp2px(7);
    }
    public PersonBannerImageLoader(int width,int height,int radiu) {
        this.mWidth = width;
        this.mHeight = height;
        this.radiu = radiu;
    }


    @Override
    public void displayImage(Context context, Object path, ImageView imageView) {

        Glide.with(context)
                .load((String) path)
                .apply(new RequestOptions().placeholder(R.mipmap.defaults_1).error(R.mipmap.defaults_1)
                        .transforms(new CenterCrop(), new RoundedCorners(radiu))).into(imageView);
    }
}
